/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package wyDatabase;

import Client.Customer;
import Client.SecureHash;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import org.hibernate.validator.constraints.Email;

/**
 *
 * @author wyjo
 */
@Entity
public class CustomerDatabase implements Serializable {
    
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    
    @NotNull
    private String Insurunce_Id;
    @NotNull
    private String hashSHA256;
    @NotNull
    private String Name;
    @NotNull
    private String Gender;
    @NotNull
    private int Age;
    @Email
    private String E_mail;
    @Pattern(regexp="\\d{1}")
    private int Insurunce_Type;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getInsurunce_Id() {
        return Insurunce_Id;
    }

    public void setInsurunce_Id(String Insurunce_Id) {
        this.Insurunce_Id = Insurunce_Id;
    }

    public String getHashSHA256() {
        return hashSHA256;
    }

    public void setHashSHA256(String hashSHA256) {
        this.hashSHA256 = hashSHA256;
    }

    public String getName() {
        return Name;
    }

    public void setName(String Name) {
        this.Name = Name;
    }

    public String getGender() {
        return Gender;
    }

    public void setGender(String Gender) {
        this.Gender = Gender;
    }

    public int getAge() {
        return Age;
    }

    public void setAge(int Age) {
        this.Age = Age;
    }

    public String getE_mail() {
        return E_mail;
    }

    public void setE_mail(String E_mail) {
        this.E_mail = E_mail;
    }

    public int getInsurunce_Type() {
        return Insurunce_Type;
    }

    public void setInsurunce_Type(int Insurunce_Type) {
        this.Insurunce_Type = Insurunce_Type;
    }
    public CustomerDatabase(){};
    public CustomerDatabase(Customer customer){
        this.Insurunce_Id = customer.getInsurunce_Id();
        this.hashSHA256 = customer.getHashSHA256();
        this.Name = customer.getName();
        this.Gender = customer.getGender();
        this.Age = customer.getAge();
        this.E_mail = customer.getE_mail();
        this.Insurunce_Type = customer.getInsurunce_Type();
    }
    public CustomerDatabase(String Insurunce_Id, String hashSHA256, String Name, String Gender, int Age, String E_mail, int Insurunce_Type) {
        this.Insurunce_Id = Insurunce_Id;
        this.hashSHA256 = hashSHA256;
        this.Name = Name;
        this.Gender = Gender;
        this.Age = Age;
        this.E_mail = E_mail;
        this.Insurunce_Type = Insurunce_Type;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CustomerDatabase)) {
            return false;
        }
        CustomerDatabase other = (CustomerDatabase) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "wyDatabase.CustomerDatabase[ id=" + id + " ]";
    }
    
}
